class Solution:
    def sumOfTheDigitsOfHarshadNumber(self, x: int) -> int:
        return ans if x % (ans := sum(map(int, str(x)))) == 0 else -1


s = Solution()
print(s.sumOfTheDigitsOfHarshadNumber(18))
